﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using ShredTheLog.Common.MVVM;
using ShredTheLog.Api;
using System.ComponentModel.Composition;

namespace ShredTheLog.ViewModels
{
    public sealed class MessageDialogViewModel : ViewModelBase
    {
        [Import]
        private IShredServices ShredServices { get; set; }

        private readonly Func<string> _windowTitle;
        private readonly Func<string> _message;

        public MessageDialogViewModel(Func<string> windowTitle, Func<string> message)
        {
            Contract.Requires(windowTitle != null);
            Contract.Requires(message != null);

            _windowTitle = windowTitle;
            _message = message;
        }

        public MessageDialogViewModel(Func<string> messageFunc)
        {
            Contract.Requires(messageFunc != null);

            _windowTitle = () => ShredServices.GetLocalizedString("s_Message");
            _message = messageFunc;
        }

        public string WindowTitle { get { return _windowTitle(); } }
        public string Message { get { return _message(); } }
    }
}
